home *** CD-ROM | disk | FTP | other *** search
/ Freelog 15 / FREELOG 15.ISO / WebMaster / Perl / PERL5106.ZIP / perl5 / ntt / Op / magic.ntt < prev    next >
Encoding:
Text File  |  1995-11-07  |  1.3 KB  |  52 lines

  1. #!./perl
  2.  
  3. # $RCSfile: magic.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:05 $
  4.  
  5. $| = 1;        # command buffering
  6.  
  7. print "1..6\n";
  8.  
  9. eval '$ENV{"foo"} = "hi there";';    # check that ENV is inited inside eval
  10.  
  11. # WYT 1995-05-03 changed to cope with MS-DOS
  12. #if (`echo \$foo` eq "hi there\n") {print "ok 1\n";} else {print "not ok 1\n";}
  13. if (`echo %foo%` eq "hi there\n") {print "ok 1\n";} else {print "not ok 1\n";}
  14.  
  15. unlink 'ajslkdfpqjsjfk';
  16. $! = 0;
  17. open(foo,'ajslkdfpqjsjfk');
  18. if ($!) {print "ok 2\n";} else {print "not ok 2\n";}
  19.  
  20. # the next tests are embedded inside system simply because sh spits out
  21. # a newline onto stderr when a child process kills itself with SIGINT.
  22.  
  23.  
  24. # JCW 1995-06-03 no kill function available for NT
  25. print "ok 3\nok 4\n";
  26. #system 'perl', '-e', <<'END';
  27. #
  28. #    $| = 1;        # command buffering
  29. #
  30. #    $SIG{"INT"} = "ok3"; kill "INT",$$;
  31. #    $SIG{"INT"} = "IGNORE"; kill 2,$$; print "ok 4\n";
  32. #    $SIG{"INT"} = "DEFAULT"; kill 2,$$; print "not ok\n";
  33. #
  34. #   sub ok3 {
  35. #    if (($x = pop(@_)) eq "INT") {
  36. #        print "ok 3\n";
  37. #    }
  38. #    else {
  39. #        print "not ok 3 $a\n";
  40. #    }
  41. #    }
  42. #
  43. #END
  44.  
  45. @val1 = @ENV{keys(%ENV)};    # can we slice ENV?
  46. @val2 = values(%ENV);
  47.  
  48. print join(':',@val1) eq join(':',@val2) ? "ok 5\n" : "not ok 5\n";
  49.  
  50. print @val1 > 1 ? "ok 6\n" : "not ok 6\n";
  51.  
  52.